                     MEMBER('dining2.clw')

!--------------------------------------------------
OpenFile:Agents PROCEDURE
  CODE
  IF Agents::Used = 0
    CheckOpen(Agents,1,,1)
  END
  BIND(AG:RECORD)
  Agents::Used += 1

!--------------------------------------------------
CloseFile:Agents PROCEDURE
  CODE
  Agents::Used -= 1
  IF Agents::Used = 0
    CLOSE(Agents)
  END

!--------------------------------------------------
OpenFile:Agents2 PROCEDURE
  CODE
  IF Agents2::Used = 0
    CheckOpen(Agents2,1,,1)
  END
  BIND(AG2:RECORD)
  Agents2::Used += 1

!--------------------------------------------------
CloseFile:Agents2 PROCEDURE
  CODE
  Agents2::Used -= 1
  IF Agents2::Used = 0
    CLOSE(Agents2)
  END

!--------------------------------------------------
OpenFile:D_ACCOUNT PROCEDURE
  CODE
  IF D_ACCOUNT::Used = 0
    CheckOpen(D_ACCOUNT,0)
  END
  BIND(D_ACC:RECORD)
  BIND('D_ACC:B_DEBET',D_ACC:B_DEBET)
  BIND('D_ACC:B_CREDIT',D_ACC:B_CREDIT)
  D_ACCOUNT::Used += 1

!--------------------------------------------------
CloseFile:D_ACCOUNT PROCEDURE
  CODE
  D_ACCOUNT::Used -= 1
  IF D_ACCOUNT::Used = 0
    CLOSE(D_ACCOUNT)
  END

!--------------------------------------------------
OpenFile:D_BLUDO PROCEDURE
  CODE
  IF D_BLUDO::Used = 0
    CheckOpen(D_BLUDO,0)
  END
  BIND(D_BLU:RECORD)
  BIND('D_BLU:ID',D_BLU:ID)
  BIND('D_BLU:GRP_ID',D_BLU:GRP_ID)
  D_BLUDO::Used += 1

!--------------------------------------------------
CloseFile:D_BLUDO PROCEDURE
  CODE
  D_BLUDO::Used -= 1
  IF D_BLUDO::Used = 0
    CLOSE(D_BLUDO)
  END

!--------------------------------------------------
OpenFile:D_CLIENT PROCEDURE
  CODE
  IF D_CLIENT::Used = 0
    CheckOpen(D_CLIENT,0)
  END
  BIND(D_CLI1:RECORD)
  BIND('D_CLI1:ID',D_CLI1:ID)
  BIND('D_CLI1:B_DEBET',D_CLI1:B_DEBET)
  BIND('D_CLI1:B_CREDIT',D_CLI1:B_CREDIT)
  D_CLIENT::Used += 1

!--------------------------------------------------
CloseFile:D_CLIENT PROCEDURE
  CODE
  D_CLIENT::Used -= 1
  IF D_CLIENT::Used = 0
    CLOSE(D_CLIENT)
  END

!--------------------------------------------------
OpenFile:D_G_NAME PROCEDURE
  CODE
  IF D_G_NAME::Used = 0
    CheckOpen(D_G_NAME,0)
  END
  BIND(D_G_N:RECORD)
  BIND('D_G_N:ID',D_G_N:ID)
  BIND('D_G_N:L_INCL',D_G_N:L_INCL)
  BIND('D_G_N:L_FORMA',D_G_N:L_FORMA)
  D_G_NAME::Used += 1

!--------------------------------------------------
CloseFile:D_G_NAME PROCEDURE
  CODE
  D_G_NAME::Used -= 1
  IF D_G_NAME::Used = 0
    CLOSE(D_G_NAME)
  END

!--------------------------------------------------
OpenFile:D_G_NORM PROCEDURE
  CODE
  IF D_G_NORM::Used = 0
    CheckOpen(D_G_NORM,0)
  END
  BIND(D_G_NORM:RECORD)
  BIND('D_G_NORM:ID',D_G_NORM:ID)
  BIND('D_G_NORM:NORMA',D_G_NORM:NORMA)
  D_G_NORM::Used += 1

!--------------------------------------------------
CloseFile:D_G_NORM PROCEDURE
  CODE
  D_G_NORM::Used -= 1
  IF D_G_NORM::Used = 0
    CLOSE(D_G_NORM)
  END

!--------------------------------------------------
OpenFile:D_ITEMS PROCEDURE
  CODE
  IF D_ITEMS::Used = 0
    CheckOpen(D_ITEMS,0)
  END
  BIND(D_ITE:RECORD)
  BIND('D_ITE:ID',D_ITE:ID)
  BIND('D_ITE:GRP_ID',D_ITE:GRP_ID)
  D_ITEMS::Used += 1

!--------------------------------------------------
CloseFile:D_ITEMS PROCEDURE
  CODE
  D_ITEMS::Used -= 1
  IF D_ITEMS::Used = 0
    CLOSE(D_ITEMS)
  END

!--------------------------------------------------
OpenFile:D_LEADS PROCEDURE
  CODE
  IF D_LEADS::Used = 0
    CheckOpen(D_LEADS,0)
  END
  BIND(D_LEA:RECORD)
  D_LEADS::Used += 1

!--------------------------------------------------
CloseFile:D_LEADS PROCEDURE
  CODE
  D_LEADS::Used -= 1
  IF D_LEADS::Used = 0
    CLOSE(D_LEADS)
  END

!--------------------------------------------------
OpenFile:D_PNITEMS PROCEDURE
  CODE
  IF D_PNITEMS::Used = 0
    CheckOpen(D_PNITEMS,0)
  END
  BIND(D_:RECORD)
  BIND('D_:ID_DOC',D_:ID_DOC)
  BIND('D_:ID_ITEM',D_:ID_ITEM)
  BIND('D_:KOLVO',D_:KOLVO)
  D_PNITEMS::Used += 1

!--------------------------------------------------
CloseFile:D_PNITEMS PROCEDURE
  CODE
  D_PNITEMS::Used -= 1
  IF D_PNITEMS::Used = 0
    CLOSE(D_PNITEMS)
  END

!--------------------------------------------------
OpenFile:D_PODR PROCEDURE
  CODE
  IF D_PODR::Used = 0
    CheckOpen(D_PODR,0)
  END
  BIND(D_POD:RECORD)
  BIND('D_POD:ID',D_POD:ID)
  BIND('D_POD:GRP',D_POD:GRP)
  D_PODR::Used += 1

!--------------------------------------------------
CloseFile:D_PODR PROCEDURE
  CODE
  D_PODR::Used -= 1
  IF D_PODR::Used = 0
    CLOSE(D_PODR)
  END

!--------------------------------------------------
OpenFile:D_PRICE PROCEDURE
  CODE
  IF D_PRICE::Used = 0
    CheckOpen(D_PRICE,0)
  END
  BIND(D_PRI:RECORD)
  BIND('D_PRI:ID',D_PRI:ID)
  BIND('D_PRI:ID_ITEM',D_PRI:ID_ITEM)
  BIND('D_PRI:PRICE',D_PRI:PRICE)
  BIND('D_PRI:P_KOEF',D_PRI:P_KOEF)
  D_PRICE::Used += 1

!--------------------------------------------------
CloseFile:D_PRICE PROCEDURE
  CODE
  D_PRICE::Used -= 1
  IF D_PRICE::Used = 0
    CLOSE(D_PRICE)
  END

!--------------------------------------------------
OpenFile:D_PRNAKL PROCEDURE
  CODE
  IF D_PRNAKL::Used = 0
    CheckOpen(D_PRNAKL,0)
  END
  BIND(D_PRN:RECORD)
  BIND('D_PRN:ID',D_PRN:ID)
  BIND('D_PRN:NUM',D_PRN:NUM)
  BIND('D_PRN:ID_MO',D_PRN:ID_MO)
  BIND('D_PRN:ID_POST',D_PRN:ID_POST)
  BIND('D_PRN:NDS',D_PRN:NDS)
  BIND('D_PRN:TR_RASX',D_PRN:TR_RASX)
  D_PRNAKL::Used += 1

!--------------------------------------------------
CloseFile:D_PRNAKL PROCEDURE
  CODE
  D_PRNAKL::Used -= 1
  IF D_PRNAKL::Used = 0
    CLOSE(D_PRNAKL)
  END

!--------------------------------------------------
OpenFile:D_RECEPT_D PROCEDURE
  CODE
  IF D_RECEPT_D::Used = 0
    CheckOpen(D_RECEPT_D,0)
  END
  BIND(D_REC_D:RECORD)
  BIND('D_REC_D:ID_RECEPT',D_REC_D:ID_RECEPT)
  BIND('D_REC_D:ID_ITEM',D_REC_D:ID_ITEM)
  BIND('D_REC_D:KOLVO',D_REC_D:KOLVO)
  D_RECEPT_D::Used += 1

!--------------------------------------------------
CloseFile:D_RECEPT_D PROCEDURE
  CODE
  D_RECEPT_D::Used -= 1
  IF D_RECEPT_D::Used = 0
    CLOSE(D_RECEPT_D)
  END

!--------------------------------------------------
OpenFile:D_RECEPT_H PROCEDURE
  CODE
  IF D_RECEPT_H::Used = 0
    CheckOpen(D_RECEPT_H,0)
  END
  BIND(D_REC_H:RECORD)
  BIND('D_REC_H:ID',D_REC_H:ID)
  BIND('D_REC_H:ID_BLUDO',D_REC_H:ID_BLUDO)
  BIND('D_REC_H:S_DAY',D_REC_H:S_DAY)
  BIND('D_REC_H:S_MONTH',D_REC_H:S_MONTH)
  BIND('D_REC_H:F_DAY',D_REC_H:F_DAY)
  BIND('D_REC_H:F_MONTH',D_REC_H:F_MONTH)
  D_RECEPT_H::Used += 1

!--------------------------------------------------
CloseFile:D_RECEPT_H PROCEDURE
  CODE
  D_RECEPT_H::Used -= 1
  IF D_RECEPT_H::Used = 0
    CLOSE(D_RECEPT_H)
  END

!--------------------------------------------------
OpenFile:D_REST PROCEDURE
  CODE
  IF D_REST::Used = 0
    CheckOpen(D_REST,0)
  END
  BIND(D_RES:RECORD)
  BIND('D_RES:ID_MO',D_RES:ID_MO)
  BIND('D_RES:ID_ITEM',D_RES:ID_ITEM)
  BIND('D_RES:KOLVO',D_RES:KOLVO)
  D_REST::Used += 1

!--------------------------------------------------
CloseFile:D_REST PROCEDURE
  CODE
  D_REST::Used -= 1
  IF D_REST::Used = 0
    CLOSE(D_REST)
  END

!--------------------------------------------------
OpenFile:D_RITEMS PROCEDURE
  CODE
  IF D_RITEMS::Used = 0
    CheckOpen(D_RITEMS,0)
  END
  BIND(D_RIT:RECORD)
  BIND('D_RIT:ID_DOC',D_RIT:ID_DOC)
  BIND('D_RIT:ID_ITEM',D_RIT:ID_ITEM)
  BIND('D_RIT:KOLVO',D_RIT:KOLVO)
  D_RITEMS::Used += 1

!--------------------------------------------------
CloseFile:D_RITEMS PROCEDURE
  CODE
  D_RITEMS::Used -= 1
  IF D_RITEMS::Used = 0
    CLOSE(D_RITEMS)
  END

!--------------------------------------------------
OpenFile:D_RNAKL PROCEDURE
  CODE
  IF D_RNAKL::Used = 0
    CheckOpen(D_RNAKL,0)
  END
  BIND(D_RNA:RECORD)
  BIND('D_RNA:ID',D_RNA:ID)
  BIND('D_RNA:NUM',D_RNA:NUM)
  BIND('D_RNA:ID_MO',D_RNA:ID_MO)
  BIND('D_RNA:ID_POST',D_RNA:ID_POST)
  D_RNAKL::Used += 1

!--------------------------------------------------
CloseFile:D_RNAKL PROCEDURE
  CODE
  D_RNAKL::Used -= 1
  IF D_RNAKL::Used = 0
    CLOSE(D_RNAKL)
  END

!--------------------------------------------------
OpenFile:D_RPOST_D PROCEDURE
  CODE
  IF D_RPOST_D::Used = 0
    CheckOpen(D_RPOST_D,0)
  END
  BIND(D_RPO_D:RECORD)
  BIND('D_RPO_D:ID_DOC',D_RPO_D:ID_DOC)
  BIND('D_RPO_D:SUMMA',D_RPO_D:SUMMA)
  D_RPOST_D::Used += 1

!--------------------------------------------------
CloseFile:D_RPOST_D PROCEDURE
  CODE
  D_RPOST_D::Used -= 1
  IF D_RPOST_D::Used = 0
    CLOSE(D_RPOST_D)
  END

!--------------------------------------------------
OpenFile:D_RPOST_H PROCEDURE
  CODE
  IF D_RPOST_H::Used = 0
    CheckOpen(D_RPOST_H,0)
  END
  BIND(D_RPO_H:RECORD)
  BIND('D_RPO_H:ID',D_RPO_H:ID)
  BIND('D_RPO_H:NUM',D_RPO_H:NUM)
  BIND('D_RPO_H:ID_POST',D_RPO_H:ID_POST)
  D_RPOST_H::Used += 1

!--------------------------------------------------
CloseFile:D_RPOST_H PROCEDURE
  CODE
  D_RPOST_H::Used -= 1
  IF D_RPOST_H::Used = 0
    CLOSE(D_RPOST_H)
  END

!--------------------------------------------------
OpenFile:D_VBLUDO PROCEDURE
  CODE
  IF D_VBLUDO::Used = 0
    CheckOpen(D_VBLUDO,0)
  END
  BIND(D_VBL:RECORD)
  BIND('D_VBL:ID',D_VBL:ID)
  D_VBLUDO::Used += 1

!--------------------------------------------------
CloseFile:D_VBLUDO PROCEDURE
  CODE
  D_VBLUDO::Used -= 1
  IF D_VBLUDO::Used = 0
    CLOSE(D_VBLUDO)
  END

!--------------------------------------------------
OpenFile:D_VMENU PROCEDURE
  CODE
  IF D_VMENU::Used = 0
    CheckOpen(D_VMENU,0)
  END
  BIND(D_VME:RECORD)
  BIND('D_VME:ID',D_VME:ID)
  BIND('D_VME:L_INCL',D_VME:L_INCL)
  D_VMENU::Used += 1

!--------------------------------------------------
CloseFile:D_VMENU PROCEDURE
  CODE
  D_VMENU::Used -= 1
  IF D_VMENU::Used = 0
    CLOSE(D_VMENU)
  END

!--------------------------------------------------
OpenFile:Documents PROCEDURE
  CODE
  IF Documents::Used = 0
    CheckOpen(Documents,1,,1)
  END
  BIND(DOC:RECORD)
  Documents::Used += 1

!--------------------------------------------------
CloseFile:Documents PROCEDURE
  CODE
  Documents::Used -= 1
  IF Documents::Used = 0
    CLOSE(Documents)
  END

!--------------------------------------------------
OpenFile:Entities PROCEDURE
  CODE
  IF Entities::Used = 0
    CheckOpen(Entities,1,,1)
  END
  BIND(ENT:RECORD)
  Entities::Used += 1

!--------------------------------------------------
CloseFile:Entities PROCEDURE
  CODE
  Entities::Used -= 1
  IF Entities::Used = 0
    CLOSE(Entities)
  END

!--------------------------------------------------
OpenFile:Journal PROCEDURE
  CODE
  IF Journal::Used = 0
    CheckOpen(Journal,1,,1)
  END
  BIND(J:RECORD)
  Journal::Used += 1

!--------------------------------------------------
CloseFile:Journal PROCEDURE
  CODE
  Journal::Used -= 1
  IF Journal::Used = 0
    CLOSE(Journal)
  END

!--------------------------------------------------
OpenFile:Series PROCEDURE
  CODE
  IF Series::Used = 0
    CheckOpen(Series,1,,1)
  END
  BIND(SER:RECORD)
  Series::Used += 1

!--------------------------------------------------
CloseFile:Series PROCEDURE
  CODE
  Series::Used -= 1
  IF Series::Used = 0
    CLOSE(Series)
  END

!--------------------------------------------------
OpenFile:T_AR_Dtl PROCEDURE
  CODE
  IF T_AR_Dtl::Used = 0
    CheckOpen(T_AR_Dtl,1,,1)
  END
  BIND(ARD:RECORD)
  BIND('ARD:Doc_ID',ARD:Doc_ID)
  T_AR_Dtl::Used += 1

!--------------------------------------------------
CloseFile:T_AR_Dtl PROCEDURE
  CODE
  T_AR_Dtl::Used -= 1
  IF T_AR_Dtl::Used = 0
    CLOSE(T_AR_Dtl)
  END

!--------------------------------------------------
OpenFile:T_AR_Hdr PROCEDURE
  CODE
  IF T_AR_Hdr::Used = 0
    CheckOpen(T_AR_Hdr,1,,1)
  END
  BIND(ARH:RECORD)
  T_AR_Hdr::Used += 1

!--------------------------------------------------
CloseFile:T_AR_Hdr PROCEDURE
  CODE
  T_AR_Hdr::Used -= 1
  IF T_AR_Hdr::Used = 0
    CLOSE(T_AR_Hdr)
  END

!--------------------------------------------------
OpenFile:T_Accounts PROCEDURE
  CODE
  IF T_Accounts::Used = 0
    CheckOpen(T_Accounts,1,,1)
  END
  BIND(ACC2:RECORD)
  T_Accounts::Used += 1

!--------------------------------------------------
CloseFile:T_Accounts PROCEDURE
  CODE
  T_Accounts::Used -= 1
  IF T_Accounts::Used = 0
    CLOSE(T_Accounts)
  END

!--------------------------------------------------
OpenFile:T_Clients PROCEDURE
  CODE
  IF T_Clients::Used = 0
    CheckOpen(T_Clients,1,,1)
  END
  BIND(CLI:RECORD)
  T_Clients::Used += 1

!--------------------------------------------------
CloseFile:T_Clients PROCEDURE
  CODE
  T_Clients::Used -= 1
  IF T_Clients::Used = 0
    CLOSE(T_Clients)
  END

!--------------------------------------------------
OpenFile:T_Dish_grp PROCEDURE
  CODE
  IF T_Dish_grp::Used = 0
    CheckOpen(T_Dish_grp,1,,1)
  END
  BIND(DGRP:RECORD)
  T_Dish_grp::Used += 1

!--------------------------------------------------
CloseFile:T_Dish_grp PROCEDURE
  CODE
  T_Dish_grp::Used -= 1
  IF T_Dish_grp::Used = 0
    CLOSE(T_Dish_grp)
  END

!--------------------------------------------------
OpenFile:T_Dishes PROCEDURE
  CODE
  IF T_Dishes::Used = 0
    CheckOpen(T_Dishes,1,,1)
  END
  BIND(DIS:RECORD)
  T_Dishes::Used += 1

!--------------------------------------------------
CloseFile:T_Dishes PROCEDURE
  CODE
  T_Dishes::Used -= 1
  IF T_Dishes::Used = 0
    CLOSE(T_Dishes)
  END

!--------------------------------------------------
OpenFile:T_G_Name PROCEDURE
  CODE
  IF T_G_Name::Used = 0
    CheckOpen(T_G_Name,1,,1)
  END
  BIND(GNAM:RECORD)
  T_G_Name::Used += 1

!--------------------------------------------------
CloseFile:T_G_Name PROCEDURE
  CODE
  T_G_Name::Used -= 1
  IF T_G_Name::Used = 0
    CLOSE(T_G_Name)
  END

!--------------------------------------------------
OpenFile:T_G_Norm PROCEDURE
  CODE
  IF T_G_Norm::Used = 0
    CheckOpen(T_G_Norm,1,,1)
  END
  BIND(GNORM:RECORD)
  T_G_Norm::Used += 1

!--------------------------------------------------
CloseFile:T_G_Norm PROCEDURE
  CODE
  T_G_Norm::Used -= 1
  IF T_G_Norm::Used = 0
    CLOSE(T_G_Norm)
  END

!--------------------------------------------------
OpenFile:T_Inventory PROCEDURE
  CODE
  IF T_Inventory::Used = 0
    CheckOpen(T_Inventory,1,,1)
  END
  BIND(INV:RECORD)
  T_Inventory::Used += 1

!--------------------------------------------------
CloseFile:T_Inventory PROCEDURE
  CODE
  T_Inventory::Used -= 1
  IF T_Inventory::Used = 0
    CLOSE(T_Inventory)
  END

!--------------------------------------------------
OpenFile:T_Invoice_Items PROCEDURE
  CODE
  IF T_Invoice_Items::Used = 0
    CheckOpen(T_Invoice_Items,1,,1)
  END
  BIND(INIT:RECORD)
  T_Invoice_Items::Used += 1

!--------------------------------------------------
CloseFile:T_Invoice_Items PROCEDURE
  CODE
  T_Invoice_Items::Used -= 1
  IF T_Invoice_Items::Used = 0
    CLOSE(T_Invoice_Items)
  END

!--------------------------------------------------
OpenFile:T_Invoices PROCEDURE
  CODE
  IF T_Invoices::Used = 0
    CheckOpen(T_Invoices,1,,1)
  END
  BIND(INVC:RECORD)
  T_Invoices::Used += 1

!--------------------------------------------------
CloseFile:T_Invoices PROCEDURE
  CODE
  T_Invoices::Used -= 1
  IF T_Invoices::Used = 0
    CLOSE(T_Invoices)
  END

!--------------------------------------------------
OpenFile:T_Item_grps PROCEDURE
  CODE
  IF T_Item_grps::Used = 0
    CheckOpen(T_Item_grps,1,,1)
  END
  BIND(ITMG:RECORD)
  T_Item_grps::Used += 1

!--------------------------------------------------
CloseFile:T_Item_grps PROCEDURE
  CODE
  T_Item_grps::Used -= 1
  IF T_Item_grps::Used = 0
    CLOSE(T_Item_grps)
  END

!--------------------------------------------------
OpenFile:T_Items PROCEDURE
  CODE
  IF T_Items::Used = 0
    CheckOpen(T_Items,1,,1)
  END
  BIND(ITM:RECORD)
  T_Items::Used += 1

!--------------------------------------------------
CloseFile:T_Items PROCEDURE
  CODE
  T_Items::Used -= 1
  IF T_Items::Used = 0
    CLOSE(T_Items)
  END

!--------------------------------------------------
OpenFile:T_Leads PROCEDURE
  CODE
  IF T_Leads::Used = 0
    CheckOpen(T_Leads,1,,1)
  END
  BIND(LDS:RECORD)
  T_Leads::Used += 1

!--------------------------------------------------
CloseFile:T_Leads PROCEDURE
  CODE
  T_Leads::Used -= 1
  IF T_Leads::Used = 0
    CLOSE(T_Leads)
  END

!--------------------------------------------------
OpenFile:T_Lots PROCEDURE
  CODE
  IF T_Lots::Used = 0
    CheckOpen(T_Lots,1,,1)
  END
  BIND(LOT:RECORD)
  T_Lots::Used += 1

!--------------------------------------------------
CloseFile:T_Lots PROCEDURE
  CODE
  T_Lots::Used -= 1
  IF T_Lots::Used = 0
    CLOSE(T_Lots)
  END

!--------------------------------------------------
OpenFile:T_Orgns PROCEDURE
  CODE
  IF T_Orgns::Used = 0
    CheckOpen(T_Orgns,1,,1)
  END
  BIND(ORGN:RECORD)
  T_Orgns::Used += 1

!--------------------------------------------------
CloseFile:T_Orgns PROCEDURE
  CODE
  T_Orgns::Used -= 1
  IF T_Orgns::Used = 0
    CLOSE(T_Orgns)
  END

!--------------------------------------------------
OpenFile:T_Recipe_Dtl PROCEDURE
  CODE
  IF T_Recipe_Dtl::Used = 0
    CheckOpen(T_Recipe_Dtl,1,,1)
  END
  BIND(RCD:RECORD)
  T_Recipe_Dtl::Used += 1

!--------------------------------------------------
CloseFile:T_Recipe_Dtl PROCEDURE
  CODE
  T_Recipe_Dtl::Used -= 1
  IF T_Recipe_Dtl::Used = 0
    CLOSE(T_Recipe_Dtl)
  END

!--------------------------------------------------
OpenFile:T_Recipe_Hdr PROCEDURE
  CODE
  IF T_Recipe_Hdr::Used = 0
    CheckOpen(T_Recipe_Hdr,1,,1)
  END
  BIND(RCH:RECORD)
  T_Recipe_Hdr::Used += 1

!--------------------------------------------------
CloseFile:T_Recipe_Hdr PROCEDURE
  CODE
  T_Recipe_Hdr::Used -= 1
  IF T_Recipe_Hdr::Used = 0
    CLOSE(T_Recipe_Hdr)
  END

!--------------------------------------------------
OpenFile:T_SalesInvoiceItems PROCEDURE
  CODE
  IF T_SalesInvoiceItems::Used = 0
    CheckOpen(T_SalesInvoiceItems,1,,1)
  END
  BIND(SINI:RECORD)
  T_SalesInvoiceItems::Used += 1

!--------------------------------------------------
CloseFile:T_SalesInvoiceItems PROCEDURE
  CODE
  T_SalesInvoiceItems::Used -= 1
  IF T_SalesInvoiceItems::Used = 0
    CLOSE(T_SalesInvoiceItems)
  END

!--------------------------------------------------
OpenFile:T_SalesInvoices PROCEDURE
  CODE
  IF T_SalesInvoices::Used = 0
    CheckOpen(T_SalesInvoices,1,,1)
  END
  BIND(SINV:RECORD)
  T_SalesInvoices::Used += 1

!--------------------------------------------------
CloseFile:T_SalesInvoices PROCEDURE
  CODE
  T_SalesInvoices::Used -= 1
  IF T_SalesInvoices::Used = 0
    CLOSE(T_SalesInvoices)
  END

!--------------------------------------------------
OpenFile:T_VBludo PROCEDURE
  CODE
  IF T_VBludo::Used = 0
    CheckOpen(T_VBludo,1,,1)
  END
  BIND(VBL:RECORD)
  T_VBludo::Used += 1

!--------------------------------------------------
CloseFile:T_VBludo PROCEDURE
  CODE
  T_VBludo::Used -= 1
  IF T_VBludo::Used = 0
    CLOSE(T_VBludo)
  END

!--------------------------------------------------
OpenFile:T_VMenu PROCEDURE
  CODE
  IF T_VMenu::Used = 0
    CheckOpen(T_VMenu,1,,1)
  END
  BIND(VMNU:RECORD)
  T_VMenu::Used += 1

!--------------------------------------------------
CloseFile:T_VMenu PROCEDURE
  CODE
  T_VMenu::Used -= 1
  IF T_VMenu::Used = 0
    CLOSE(T_VMenu)
  END

!--------------------------------------------------
OpenFile:Units PROCEDURE
  CODE
  IF Units::Used = 0
    CheckOpen(Units,1,,1)
  END
  BIND(UN:RECORD)
  Units::Used += 1

!--------------------------------------------------
CloseFile:Units PROCEDURE
  CODE
  Units::Used -= 1
  IF Units::Used = 0
    CLOSE(Units)
  END
